import {
  Column,
  CreateDateColumn,
  Entity,
  ManyToMany,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';
import { Role } from '../../roles/entities/role.entity';

@Entity()
export class Menu {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column('varchar', { length: 200 })
  menuName: string;

  @Column('varchar', { length: 200 })
  menuNo: string;

  @Column({ type: 'varchar', length: 200 })
  path: string;

  @Column({ type: 'varchar', length: 200 })
  component: string;

  @Column({ type: 'varchar', length: 200 })
  parentId: string;

  @ManyToMany(() => Role, (role) => role.menus)
  roles: Role[];

  @CreateDateColumn()
  createDate: Date;
  @UpdateDateColumn()
  updateDate: Date;
}
